//
//  ProgressItemView.m
//  HNBaseProject
//
//  Created by Apple on 2024/7/30.
//

#import "ProgressItemView.h"

@implementation ProgressItemView

-(instancetype)init{
    self = [super init];
    if (self) {
        [self setupUI];
    }
    return self;
}

-(void)setupUI{
    
    self.iconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"accept_success"]];
    self.iconView.hidden = YES;
    [self addSubview:self.iconView];
    [self.iconView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.left.offset(30);
        make.top.offset(7);
        make.size.mas_equalTo(CGSizeMake(20, 20));
    }];
    
    self.indicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(30, 7, 20, 20)];
    [self addSubview:self.indicatorView];
    [self.indicatorView startAnimating];
    
    
    self.descLab = [[UILabel alloc] init];
    self.descLab.numberOfLines = 0;
    self.descLab.font = PFRFont(14);
    self.descLab.dc_lineHeight = 20;
    self.descLab.dc_text = @" ";
    self.descLab.textColor = [UIColor dc_colorWithHexString:DC_333333];
    [self addSubview:self.descLab];
    [self.descLab mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.offset(7);
        make.left.equalTo(self.iconView.mas_right).offset(10);
        make.right.offset(-30);
        make.bottom.offset(-7);
    }];
    
}

-(void)success{
    [self.indicatorView stopAnimating];
    [self.indicatorView removeFromSuperview];
    self.iconView.hidden = NO;
    self.descLab.textColor = [UIColor dc_colorWithHexString:DC_999999];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
